﻿namespace App.Commands

open System
open System.Windows
open System.Windows.Input

type DelegateCommand (execute : obj -> unit, canExecute : obj -> bool) =
        
        let event = DelegateEvent<EventHandler>()

        new (execute : obj -> unit) =  new DelegateCommand (execute ,  (fun _ -> true))

        interface ICommand with
            [<CLIEvent>]
            member x.CanExecuteChanged = event.Publish
            member x.Execute arg = execute arg
            member x.CanExecute arg = canExecute arg
